package lijun;

public class YZT {
    private double radius;
    private double height;

    public YZT() {
        this.radius = 1;
        this.height = 1;
    }

    public YZT(double radius, double height) throws Exception {
        this.radius = radius;
        this.height = height;
        if (radius <= 0 || height <= 0) {
            throw new Exception("半径和高要大于0！！");
        }
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public double calTJ() {
        return 3.14 * radius * radius * height;
    }

    public double calBMJ() {
        return 2 * 3.14 * radius * radius + 2 * 3.14 * radius * height;
    }
}
